package com.tzy.for10evalue.utils;

import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

/**
 * @author tzy
 * @date 2021/12/17 10:06
 */
public class DateUtil {

    /**
     * 获取当前到目标日期的分钟数
     *
     * @param latestDate
     * @return
     */
    public Long getCountMinutesFromNowToDate(Date latestDate) {
        Duration duration = Duration.between(LocalDateTime.ofInstant(latestDate.toInstant(), ZoneId.systemDefault()), LocalDateTime.now());
        Long exportInterval = duration.toMinutes();
        return exportInterval;
    }


}
